///<reference path='../platform/Extensions.ts'/>
///<reference path='../../decls/node.d.ts'/>
require( '../platform/Extensions' );
import ObjectModel = module('../ObjectModel');
import Contracts = module('../Contracts');

//
export function toRow(doc: ObjectModel.DocumentFlake, schema: Contracts.IDocumentSchema): IRow {
	var k = schema.getQualifiedName().getFullName() + doc.id.toString();
	return {
		key: k,
		columns: getColumnsFromDoc( doc, schema )
	};
}

//
export function toDocument(row: IRow, schema: Contracts.IDocumentSchema): ObjectModel.DocumentFlake {
    return null;
}

// Representa uma linha de dados
export interface IRow {
    key: string;
    columns: IColumn[];
}

// Representa uma coluna com valores
export interface IColumn {
    name: string;
    value: any;
}



function getColumnsFromDoc(doc: ObjectModel.DocumentFlake, schema: Contracts.IDocumentSchema): IColumn[] {
	var a: Array;

	var columns = new IColumn[];

    //for(var field in schema.fields)
        
	
    return null;
}